home *** CD-ROM | disk | FTP | other *** search
/ Night Owl 9 / Night Owl CD-ROM (NOPV9) (Night Owl Publisher) (1993).ISO / 018a / af125.zip / AF.INC < prev    next >
Text File  |  1991-11-06  |  2KB  |  53 lines

  1. Function sCheck(Mask,Nom:String):Boolean;
  2. Var i,j,k:Byte;
  3.     Pile:Array[1..9] of Record a,b:Byte; End;
  4.     PileP:Byte;
  5.     lm:Byte absolute Mask;
  6.     ln:Byte absolute Nom;
  7.     Impasse:Boolean;
  8. Begin
  9.      i:=1; j:=1; sCheck:=False; PileP:=0; Impasse:=False;
  10.      Repeat
  11.            if Mask[i]<>'*' then
  12.               if (j<=ln) and ((Mask[i]='?') or (Mask[i]=Nom[j]) or
  13.                  ((Mask[i]='#') and (Nom[j]>='0') and (Nom[j]<='9'))) then
  14.                  Begin
  15.                       Inc(i); Inc(j);
  16.                  End else
  17.                  Impasse:=True else
  18.               Begin
  19.                    if i=lm then Begin sCheck:=True; Exit; End else
  20.                    Begin
  21.                         k:=j;
  22.                         While (k<=ln) and (Nom[k]<>Mask[i+1]) and
  23.                               (Mask[i+1]<>'?') and
  24.                               ((Mask[i+1]<>'#') or not (Nom[k] in ['0'..'9']))
  25.                               do Inc(k);
  26.                         if k<=ln then
  27.                         Begin
  28.                              Inc(PileP);
  29.                              With Pile[PileP] do
  30.                              Begin
  31.                                   a:=i; b:=k+1;
  32.                              End;
  33.                              Inc(i,2); j:=k+1;
  34.                              if j>ln then
  35.                                 if (i=Length(Mask)) and (Mask[i]='*')
  36.                                    then Inc(i) else Impasse:=True;
  37.                         End else Impasse:=True;
  38.                    End;
  39.               End;
  40.            if (i>lm) then if (j>ln) then
  41.            Begin
  42.                 sCheck:=True; Exit;
  43.            End else Impasse:=True;
  44.            if Impasse then
  45.               if PileP>0 then
  46.               Begin
  47.                    With Pile[PileP] do Begin i:=a; j:=b; End; Dec(PileP);
  48.                    Impasse:=False;
  49.                    if j>ln then Exit;
  50.               End else Exit;
  51.      Until false;
  52. End;
  53.